﻿using UnityEngine;
using System.Collections;

namespace DragonRescue3D
{
    public class EndLvlMsg : MonoBehaviour
    {
        public GameObject NextLevelBtn;
        public GameObject RestartLevelBtn;
        public AudioClip _levelFailed;
        public AudioClip _levelComplete;

        /// <summary>
        /// Shows the level succeeded message, plays appropriate music and displays the next level button
        /// </summary>
        public void ShowLevelSucceeded()
        {
            TextMesh msgText = GetComponent(typeof(TextMesh)) as TextMesh;
            GetComponent<AudioSource>().clip = _levelComplete;
            GetComponent<AudioSource>().Play();
            msgText.text = "目标达成!\n 可以进入下一关了!";
            NextLevelBtn.SetActive(true);
            RestartLevelBtn.SetActive(false);
        }

        /// <summary>
        /// Shows the level failed message, plays appropriate music and displays the restart level button
        /// </summary>
        /// <param name="remainingDragons">Number of dragons remaining in the scene</param>
        public void ShowLevelFailed(int remainingDragons)
        {
            TextMesh msgText = GetComponent(typeof(TextMesh)) as TextMesh;
            GetComponent<AudioSource>().clip = _levelFailed;
            GetComponent<AudioSource>().Play();
            msgText.text = string.Format("游戏结束!\n", remainingDragons);
            RestartLevelBtn.SetActive(true);
            NextLevelBtn.SetActive(false);
        }
    }
}

#if NO_AND_ERROR
public void TEXT1() 
{
	int textNum = 1;
	if (textNum == 1) 
	{
		textNum = 2;
    }
}
public void TEXT2()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
public void TEXT3()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT4()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT5()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT6()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT8()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT9()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT10()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT11()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT12()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT13()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT14()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT15()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT16()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT17()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
#endif